#define _CRT_SECURE_NO_WARNINGS 1
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

string largestNumber(vector<int>& nums) {
    vector<string> str;
    for (int e : nums)
        str.push_back(to_string(e));
    sort(str.begin(), str.end(), [](const string& s1, const string& s2)
        {
            return s1 + s2 > s2 + s1;
        });
    for (auto e : str)
        cout << e << " ";
    string ret;
    for (auto& e : str)
        ret += e;
    if (ret[0] == '0')
        return "0";
    return ret;
}